<!DOCTYPE HTML SYSTEM "http://www.bitzermobile.com/bitzer/dtd/HTML401-loose-bitzer.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="bitzer-component" content="data">
                <?php
                if (!$isBitzer) {
                echo '
                        <title>'.$GLOBALS["catalog_name"].'</title>
                        <LINK REL=StyleSheet HREF="',$app->appRoot,'include/style.css" TYPE="text/css" MEDIA=screen>
                <script type="text/javascript" src="',$app->appRoot,'include/niftycube.js"></script>
                <script type="text/javascript">
            window.onload=function(){
                                var width = "';
                if ($component->recordCountOnly != "Y") {

			$numberOfColumns = count($component->requestColumns);
			$width = $numberOfColumns * 150;

                        echo "".$width.'px";';
                } else
                        echo '500px";';

                        echo '  setAppRoot("',$app->appRoot,'");
                Nifty("div#container");
                Nifty("div#content,div#nav","same-height small");
                Nifty("div#header,div#footer","small");
                Nifty("ul.postnav a","transparent");
                                setWidth("div#container", width);
                                setWidth("div#content", width);
                                setWidth("div#footer", width);
            }
        </script>';
        } else {
                        echo '<title></title>';
                }
                ?>    
    </head>
    <body>
    <?php
        if (!$isBitzer) {
                echo '
        <div id="container">
            <div id="header">
                <table width="100%">
                                        <tr>
                                                <td width="95%"><h1>'.$component->moduleName.'</h1></td>
                                                <td align="right" width="5%"><a href="',$app->appRoot,'Logout.php">Logout</a></td>
                                        </tr>
                                </table>
            </div>
            <div id="content">
            <br>';
        }
        ?>
                <table data-bitzer-data="true" data-bitzer-title="<?php echo $bitzerComponentTitle ?>"
                       data-bitzer-desc="<?php echo $bitzerComponentDesc ?>"
                       data-bitzer-component="<?php echo $bitzerComponent ?>"
                                           data-bitzer-record-count="<?php echo $component->recordCount; ?>"
                       <?php if (!$isBitzer) echo 'border="0" cellspacing="0" cellpadding="0"'; ?>
                       <?php
                        if ($component->recordCountOnly != "Y")
                                echo 'data-bitzer-start-index="',$component->startIndex,'" data-bitzer-number-of-rows="',$component->numberOfRows,'" ';
                                                ?>
                       class="list"  width="100%">

<?php
if( $component->numberOfRows > 0 && $component->recordCountOnly != "Y"){
?>
                                                <tr>
                                                <?php
						if (!isset($hideDeleteColumn) || $hideDeleteColumn == false)  {
                                                	if ($component->keysOnly != "Y" && !$isBitzer) {
                                                        	if ($array['deleted'] == "1") {
                                                                	echo '<th></th>';
                                                        	} else {
                                        				echo '<th>Delete</th>';
                                                        	}
						}
                        }
                                                ?>
                        <th data-bitzer-field="id" data-bitzer-key-order="1" data-bitzer-ignore-anchor="true">id</th>
                        <?php
                        if ($component->keysOnly != "Y" ) {
                                foreach ($component->requestColumns as $column) {
                                        printBitzerTH($column, $isBitzer);
                                }
                        ?>

                            <th data-bitzer-field="last_modified_on">Last Modified On</th>
                        <?php
                                                }
                                                ?>
                        </tr>
                        <?php
                        
                                                foreach($rows as $row){
                         
                         	$row = nameValuePairToSimpleArray($row['name_value_list']);
                    
                                                        $fontStartTag = '';
                                                        $fontEndTag = '';

                                echo '<tr';
							if (!isset($hideDeleteColumn) || $hideDeleteColumn == false)
                                                        if ($row['deleted'] == "1") {
                                                                if (!$isBitzer) {
                                                                        $fontStartTag = '<font color="#FF0000"><del>';
                                                                        $fontEndTag = '</del></font>';
                                                                }
                                                                echo ' data-bitzer-deleted="true"';
                                                        }
                                                        echo '>';
							if (!isset($hideDeleteColumn) || $hideDeleteColumn == false)
                                                        if ($component->keysOnly != "Y" && !$isBitzer) {
                                                                if ($row['deleted'] == "1") {
                                                                        echo '<td></td>';
                                                                } else {
                                                                        echo '<td><a href="Save.php?actionType=DELETE&id=', $row['id'],'">Delete</a></td>';
                                                                }
                                                        }

                                                        echo '<td>';
                                                        if (!$isBitzer)
                                                                echo $fontStartTag;
                                                        if ($component->keysOnly != "Y" && !$isBitzer) {
                                                                echo '<a href="Form.php?actionType=UPDATE&id=', $row['id'],'">',$row['id'],'</a>';
                                                        } else {
                                                                echo $row['id'];
                                                        }
                                                        if (!$isBitzer)
                                                                echo $fontEndTag;
                                                        echo '</td>';

                                                        if ($component->keysOnly != "Y") {
                                                                foreach ($component->requestColumns as $column) {
									if ($column == "photo_c") {
                                                                                echo '<td>';
                                                                                if (!$isBitzer)
                                                                                        echo $fontStartTag;
                                                                                echo '<IMG SRC="',$row['photo_c'],'" height="75">';
                                                                                if (!$isBitzer)
                                                                                        echo $fontEndTag;
                                                                                echo '</td>';
                                                                        } else {
                                                                                printBitzerTD($row[$column], $fontStartTag, $fontEndTag, $isBitzer);
                                                                        }

                                                                        #printBitzerTD($row[$column], $fontStartTag, $fontEndTag, $isBitzer);
                                                                }
                                                                printBitzerTD($row[$column], $fontStartTag, $fontEndTag, $isBitzer);
                                                        }
                            echo '</tr>';
                                                }

} else if ($component->recordCountOnly == "Y") {
        echo "<tr><td>Record Count</td><td>".$recordCount."</td></tr>";
}
                                                ?>
                </table>
    <?php
        if (!$isBitzer) {
                if ($component->recordCountOnly != "Y")
                echo '
                <br>
                <ul class="postnavList">
                    <li><a href="Form.php">Add New Account</a></li>
                </ul>';
                echo '
            </div>
            <div id="footer"></div>
        </div>';

$time_end = microtime(true);
$time = $time_end - $time_start;

echo "response time: $time seconds\n";
        }
        ?>
    </body>
</html>
                        
